<template>
  <div class="container">
    <data-view
      propViewKey="device_ledger"
      propViewForm="device/device_ledger/device_ledger_detail.vue"
      :propIsTdesign="true"
      @extra-button-click="extraButtonClick"
    />
  </div>
</template>

<script>
import customAnchor from '@/components/custom/form/customAnchor.vue'

export default {
  desc: '设备台账-列表',
  data() {
    return {
    }
  },
  components: {
    customAnchor
  },
  methods: {
    extraButtonClick(para) {
      console.log('para', para)
      let buttonKey = para.button.key
      if (buttonKey === 'print') { // 打印标签
        let param = {
          rows: [para.data]
        }
        global.utilPrint.openLabelDevice(param)
        return
      }
      if (buttonKey === 'printBatch') { // 打印标签
        if (para.data.length == 0) {
          this.utilMessage.warning('请选择需要打印的设备')
          return
        }
        let param = {
          rows: para.data
        }
        global.utilPrint.openLabelDevice(param)
        return
      }
    }
  }
}
</script>
